<div class="dux-page-header uk-clearfix">
    <div class="page-title">
        <a class="uk-button uk-button-primary" href="{url('index')}"> 碎片列表</a>
    </div>
    <div class="page-action">
        <a class="uk-button uk-button-danger" href="javascript:location.reload();"><i class="fa fa-refresh"></i></a>
    </div>
</div>

<div class="uk-margin-top">
    <div class="uk-card uk-card-small uk-card-default dux-panel">
        <div class="uk-card-header">{$assignName}碎片</div>
        <div class="uk-card-body">
            <form class="dux-form uk-form  uk-form-horizontal  " data-dux="form-bind" method="post">
                <fieldset>
                    <div class="uk-form-group">
                        <label class=" uk-form-label">碎片描述</label>
                        <div class="uk-form-controls">
                            <input type="text" name="title" value="{$info.title}" placeholder="请输入碎片描述" required>
                        </div>
                    </div>

                    <div class="uk-form-group">
                        <label class=" uk-form-label">编辑器</label>
                        <?php if(!isset($info['editor'])) $info[ 'editor']=1 ; ?>
                        <div class="uk-form-controls uk-form-controls-text">
                            <div class="uk-grid">
                                <label>
                                    <!--if{$info['editor']}-->
                                    <input class="editor" name="editor" value="1" checked="checked" type="radio"  class="uk-radio" >
                                    <!--{else}-->
                                    <input class="editor" name="editor" value="1" type="radio"  class="uk-radio" >
                                    <!--{/if}-->
                                    使用
                                </label>

                                <label>
                                    <!--if{!$info['editor']}-->
                                    <input class="editor" name="editor" checked="checked" value="0" type="radio"  class="uk-radio" >
                                    <!--{else}-->
                                    <input class="editor" name="editor" value="0" type="radio"  class="uk-radio" >
                                    <!--{/if}-->
                                    不使用
                                </label></div>
                        </div>
                    </div>

                    <div class="uk-form-group">
                        <label class=" uk-form-label">碎片内容</label>
                        <div class="uk-form-controls">
                            <textarea data-dux="form-editor" id="content" name="content" style="height: 300px"
                            <!--if{!$info['editor']}-->
                                      data-load="false"
                            <!--{/if}-->
                            >{$info.content}</textarea>
                        </div>
                    </div>
                    <div class="uk-form-group">
                        <div class="uk-form-controls">
                            <input type="hidden" name="fragment_id" value="{$info.fragment_id}">
                            <button class="uk-button uk-button-primary" type="submit" disabled>保存</button>
                        </div>
                    </div>

                </fieldset>
            </form>
        </div>
    </div>
</div>
<script>
    Do('base', 'editor', function() {
        $('.editor').on('click', function() {
            editor($(this).val());
        });
        var editor = function(status) {
            if(status == 1) {
                form.editor($('#content')[0]);
            }else {
                window['contentEditor'].destroy(true);
            }
        };


    });
</script>